package com.chinaer.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper {
	private static final String DB_NAME = "dunlam.db";
	private static final int DB_VERSION = 1;
	private static final String CREATE_TABLE_HIS_ISSUE = "create table his_issue (lottery_id text,lottery_type text,issue text, time text,tname text);";
	private static final String CREATE_TABLE_DRAW = "create table draw (lottery_id text,lottery_type text,issue text, winnumber text,tname text);";

	public DBHelper(Context context, String name, CursorFactory factory,
			int version) {
		super(context, DB_NAME, factory, version);
	}

	public DBHelper(Context context) {
		super(context, DB_NAME, null, DB_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(CREATE_TABLE_HIS_ISSUE);
		db.execSQL(CREATE_TABLE_DRAW);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("drop table if exists his_issue;");
		db.execSQL("drop table if exists draw;");
		onCreate(db);
	}

}
